package com.godyao.common;

import com.godyao.framework.beans.factory.config.BeanPostProcessor;
import com.godyao.service.UserService;

public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postPrecessBeanBeforeInitialization(Object bean, String beanName) {
        if ("userService".equals(beanName)) {
            UserService userService = (UserService) bean;
            userService.setLocation("改成：北京");
        }
        return bean;
    }

    @Override
    public Object postProcessBeanAfterInitialization(Object bean, String beanName) {
        if ("userService".equals(beanName)) {
            System.out.println("userService执行初始化方法之后--postProcessBeanAfterInitialization");
        }
        return bean;
    }
}
